package GUI;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.*;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

public class Product extends JFrame {

	private JPanel contentPane;

	/**
	 * Create the frame.
	 */
	public Product(String s) {

		if(s.equals("new")){setTitle("Add product");}
		else{setTitle("Manage product");}
		
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 240, 225);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JLabel lblName = new JLabel("Name:");
		lblName.setBounds(10, 14, 46, 14);
		contentPane.add(lblName);
		
		JLabel lblPrice = new JLabel("Price:");
		lblPrice.setBounds(10, 39, 46, 14);
		contentPane.add(lblPrice);
		
		JLabel lblBarcode = new JLabel("Barcode:");
		lblBarcode.setBounds(10, 64, 46, 14);
		contentPane.add(lblBarcode);
		
		JLabel lblLocation = new JLabel("Location:");
		lblLocation.setBounds(10, 89, 46, 14);
		contentPane.add(lblLocation);
		
		JLabel lblDiscount = new JLabel("Discount:");
		lblDiscount.setBounds(10, 114, 46, 14);
		contentPane.add(lblDiscount);
		
		JTextField txtItemName = new JTextField();
		txtItemName.setBounds(63, 11, 152, 20);
		contentPane.add(txtItemName);
		txtItemName.setColumns(10);
		
		JTextField txtItemDiscount = new JTextField();
		txtItemDiscount.setBounds(63, 111, 58, 20);
		contentPane.add(txtItemDiscount);
		txtItemDiscount.setColumns(10);
		
		JTextField txtItemPrice = new JTextField();
		txtItemPrice.setBounds(63, 36, 152, 20);
		contentPane.add(txtItemPrice);
		txtItemPrice.setColumns(10);
		
		JTextField txtItemBarcode = new JTextField();
		txtItemBarcode.setBounds(63, 61, 86, 20);
		contentPane.add(txtItemBarcode);
		txtItemBarcode.setColumns(10);
		
		JComboBox comboLocation = new JComboBox();
		comboLocation.setModel(new DefaultComboBoxModel(new String[] {"Here", "There"}));
		comboLocation.setEditable(true);
		comboLocation.setBounds(63, 86, 152, 20);
		contentPane.add(comboLocation);
		
		JLabel lblPerCent = new JLabel("%");
		lblPerCent.setBounds(131, 114, 18, 14);
		contentPane.add(lblPerCent);
		
		JButton btnNewButton = new JButton("Scan");
		btnNewButton.setBounds(155, 60, 60, 20);
		contentPane.add(btnNewButton);
		
		JButton btnAddDisc = new JButton("Add");
		btnAddDisc.setBounds(155, 110, 60, 20);
		contentPane.add(btnAddDisc);
		
		JButton btnCancel = new JButton("Cancel");
		btnCancel.setBounds(10, 154, 89, 23);
		contentPane.add(btnCancel);
		
		JButton btnSave = new JButton("Save");
		btnSave.setBounds(126, 154, 89, 23);
		contentPane.add(btnSave);
	}

}
